package com.shareach.domain;

import java.util.Date;

import org.apache.commons.lang.StringUtils;
import org.springframework.data.mongodb.core.mapping.Document;

import com.shareach.domain.common.Entity;

/**
 * 品牌
 * 
 * @author zuoshuaiok@gmail.com
 * 
 *         2013-1-28
 */
@Document(collection = "baseBrand")
public class BaseBrandDomain extends Entity {

	private String name;
	private String alias;
	private Long shopCount;
	// baseCtiy--->cityId
	private Long city;
	// 更新时间或者创建时间
	private Date updateTime = new Date();;
	// 上架时间
	private Date deployTime;
	// 创建时间
	private Date creatTime;
	//
	private String icon;

	// 状态
	private Integer status;

	public String getIcon() {
		return icon;
	}

	public void setIcon(String icon) {
		this.icon = icon;
	}

	public Date getCreatTime() {
		return creatTime;
	}

	public void setCreatTime(Date creatTime) {
		this.creatTime = creatTime;
	}

	public Date getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}

	public Date getDeployTime() {
		return deployTime;
	}

	public void setDeployTime(Date deployTime) {
		this.deployTime = deployTime;
	}

	public Long getCity() {
		return city;
	}

	public void setCity(Long city) {
		this.city = city;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getAlias() {
		return alias;
	}

	public void setAlias(String alias) {
		this.alias = alias;
	}

	public Long getShopCount() {
		return shopCount;
	}

	public void setShopCount(Long shopCount) {
		this.shopCount = shopCount;
	}

	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	public BaseBrandDomain compareTo(BaseBrandDomain domain) {
		BaseBrandDomain change = new BaseBrandDomain();
		if (null == domain)
			return change;
		if (StringUtils.isNotEmpty(domain.getName())) {
			if (this.name == null || !this.name.trim().equals(domain.getName().trim())) {
				change.setName(domain.getName());
			}
		}
		if (StringUtils.isNotEmpty(domain.getAlias())) {
			if (this.alias == null || !this.alias.trim().equals(domain.getAlias().trim())) {
				change.setAlias(domain.getAlias().trim());
			}
		}
		if (StringUtils.isNotEmpty(domain.getIcon())) {
			if (this.icon == null || !this.icon.trim().equals(domain.getIcon().trim())) {
				change.setIcon(domain.getIcon().trim());
			}
		}
		if (domain.getShopCount() != null) {
			if (this.shopCount == null || !this.shopCount.equals(domain.getShopCount())) {
				change.setShopCount(domain.getShopCount());
			}
		}
		if (domain.getStatus() != null) {
			if (this.status == null || !this.status.equals(domain.getStatus())) {
				change.setStatus(domain.getStatus());
			}
		}
		return change;
	}
}
